package com.astrocsr.common.util;

import java.math.BigDecimal;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ConverterUtil {
	public static BigDecimal ToBigDecimal(String o){
		try {
			return new BigDecimal(o.replaceAll(",",""));
		} catch (Exception e) {
			return BigDecimal.ZERO;
		}
	}
	
	public static String ToDateStr(Date o){
		try {
			return DateUtil.formatLocalSlash(o);
		} catch (Exception e) {
			return "";
		}
	}
	
	public static BigDecimal MoneyToBigDecimal(String o){
		try {
			return ToBigDecimal(o.replaceAll("^[^-|\\d]*|,", ""));
		} catch (Exception e) {
			return BigDecimal.ZERO;
		}
	}
}
